﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace CKNetFrameWork
{
    public partial class Frm_Home : DockContent
    {
        public Frm_Home()
        {
            InitializeComponent();
        }

        private void Frm_Home_Load(object sender, EventArgs e)
        {
            foreach (Control tempcon in this.Controls)
            {
                switch (tempcon.GetType().ToString())
                {

                    case "System.Windows.Forms.Panel":
                        {
                            Panel p = tempcon as Panel;
                            foreach (Control control in p.Controls)
                            {
                                if (control is ImageButton)
                                {
                                    if (!Frm_Main.m_dicFormText2FormTypeName.Keys.Contains(control.Tag.ToString()))
                                    {
                                        control.Enabled = false;
                                    }
                                }

                            }
                            break;
                        }
                    default:
                        break;

                }
            }
            
        }

        private void Frm_Home_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
        }

        private void Frm_Home_Resize(object sender, EventArgs e)
        {
            this.panel1.Location = new Point((this.Width - this.panel1.Width) / 2, (this.Height - this.panel1.Height) / 2);
            //this.panel1.Location.X = (this.Width - this.panel1.Width) / 2;
            //this.panel1.Location.X = (this.Width - this.panel1.Width) / 2;
        }

        private void imageButtonStudent_Click(object sender, EventArgs e)
        {
            ImageButton tsmi = (ImageButton)sender;
            Frm_Main.GetMainForm().ShowContent(tsmi.Tag.ToString());
        }

        private void imageButtonTeach_Click(object sender, EventArgs e)
        {
            ImageButton tsmi = (ImageButton)sender;
            Frm_Main.GetMainForm().ShowContent(tsmi.Tag.ToString());
        }

        private void imageButtonBasicInfo_Click(object sender, EventArgs e)
        {
            ImageButton tsmi = (ImageButton)sender;
            Frm_Main.GetMainForm().ShowContent(tsmi.Tag.ToString());
        }

        private void imageButtonData_Click(object sender, EventArgs e)
        {
            ImageButton tsmi = (ImageButton)sender;
            Frm_Main.GetMainForm().ShowContent(tsmi.Tag.ToString());
        }


    }
}
